package com.chao.rabbit.receiver;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author : Rookie
 * @description :
 * @date : 2022/10/30
 */
@Component
public class FanoutConsumer {

    @RabbitListener(bindings = {
            @QueueBinding(exchange = @Exchange(name = "fanout-test",type = "fanout"), //指定交换机名称和类型
                    value = @Queue) //创建临时队列
    })
    public void receive1(String message) {
        System.out.println("收到fanout类型消息1" + message);
    }

    @RabbitListener(bindings = {
            @QueueBinding(exchange = @Exchange(name = "fanout-test",type = "fanout"), //指定交换机名称和类型
                    value = @Queue) //创建临时队列
    })
    public void receive2(String message) {
        System.out.println("收到fanout类型消息2" + message);
    }
}
